/**
 * @author amalafe
 */

Namespace("sketch.framework");

(function(){
	// usings
	var fwk = sketch.framework;
	fwk.Observer = klass(null, {
		_constructor:function(){
			this.elements = new Array();
		},
		bind : function(obj, name){
			this.elements.push({
				obj : obj,
				name: name
				});
		},
		invoke : function(){
			for (var i = this.elements.length - 1; i >= 0; i--){
				var el = this.elements[i]; 
				el.obj[el.name].apply(el.obj, arguments);
			};
		},
		unbind : function(obj, name){
			for (var i = this.elements.length - 1; i >= 0; i--){
				var el = this.elements[i];
				if(el.obj === obj && el.name === name){
					this.elements.slice(i, 1);
				} 					
			};
		}	
	});	
})();



